<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Westalgo登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="lib/layui/css/layui.css">
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/animate.min.css" />
    <link rel="stylesheet" href="css/login.css" />
    <link rel="stylesheet" href="lib/nprogress/nprogress.css">
</head>

<body>
    <div class="login-box animated rotateIn">
        <div class="head"></div>
        <div class="input-box">
            <form class="layui-form" action="">
                <input type="text" name="username" required lay-verify="required" placeholder="邮箱/手机号/平台账号"
                    autocomplete="off" class="layui-input">
                <input type="password" name="password" required lay-verify="required" placeholder="密码" autocomplete="off"
                    class="layui-input">
                <!-- <div class="remember-me">
                    <span>记住我：</span>
                    <input type="checkbox" name="zzz" lay-skin="switch" lay-text="是|否">
                </div> -->
                <input type="submit" value="登 录" lay-submit lay-filter="login">
            </form>
            <!-- <div class="oauth">
                <i class="iconfont icon-WechatIMG" style="font-size: 25px;"></i>
                <i class="iconfont icon-github"></i>
                <i class="iconfont icon-logo-weibo"></i>
                <i class="iconfont icon-qq"></i>
                <i class="iconfont icon-weixin"></i>
                <i class="iconfont icon-zhifubao"></i>
            </div> -->
        </div>
        <!-- <div class="copyright">
            © 2018-2019 ok-admin. All rights reserved.
        </div> -->
    </div>
    <!--js逻辑-->
    <script src="lib/layui/layui.js"></script>
    <script src="lib/nprogress/nprogress.js"></script>
    <script src="js/md5.js" type="text/javascript"></script>
    <script>
        layui.use(['form', 'jquery'], function () {
            var form = layui.form;
            var $ = layui.jquery;

            form.on('submit(login)', function (data) {
                data.field.password = hex_md5(data.field.password);
                layer.msg('登录中......');
                $.ajax({
                    url: '/login/dologin',
                    method: 'post',
                    data: data.field,
                    dataType: 'JSON',
                    success: function (res) {
                        if (res.code == 1) {
                            window.location = '/';
                        } else {
                            layer.msg('帐户不正确');
                        }
                    },
                    error: function (data) {}
                })
                return false;
            });

            //ajax提交登录请求
            // layer.msg("登陆中...", {icon: 6, time: 1000, anim: 4}, function () {
            //     window.location = "index.html";
            // });
            // return false;
            // });

            // $(".oauth .icon-WechatIMG").click(function () {
            //     layer.msg('正在打开Gitee登陆页面，请稍后...');
            // });

            // $(".oauth .icon-github").click(function () {
            //     layer.msg('正在打开Github登陆页面，请稍后...');
            // });

            // $(".oauth .icon-logo-weibo").click(function () {
            //     layer.msg('正在打开微博登陆页面，请稍后...');
            // });

            // $(".oauth .icon-qq").click(function () {
            //     layer.msg('正在打开QQ登陆页面，请稍后...');
            // });

            // $(".oauth .icon-weixin").click(function () {
            //     layer.msg('正在打开微信登陆页面，请稍后...');
            // });

            // $(".oauth .icon-zhifubao").click(function () {
            //     layer.msg('正在打开支付宝登陆页面，请稍后...');
            // });
        });
    </script>
</body>

</html>